package UnitTests;

import java.io.IOException;

import Watcher.impl.Exporter;
import Watcher.impl.Favorite;
import Watcher.impl.Favorites;
import junit.framework.TestCase;
import Watcher.IFavorites;
import Watcher.impl.VideoDummy;

public class ExporterTest extends TestCase {
	public ExporterTest(String name) {
		super(name);
	}

	public void testExport() throws IOException, ClassNotFoundException {
		String path = "hans.xml";
		Favorite fav = new Favorite("www.Hanspeter.de", "handsele the rocker");
		Exporter.write(path, fav);
		Favorite fav2 = Exporter.read(path);
	}

	public void testFavoritesExport() throws IOException, ClassNotFoundException {
		String path = "hans.txt";
		Favorites favs = new Favorites(new VideoDummy());
		favs.add(new Favorite("www.hans.com", "hansele"));
		favs.add(new Favorite("www.peter.de", "peter"));
		favs.add(new Favorite("www.marla.com", "marla"));
		Exporter.write(path, favs);
		IFavorites favs2 = Exporter.read(path);
	}

	public static void main(String[] args) {
		junit.swingui.TestRunner.run(ExporterTest.class);
	}
}
